(function ($,jQuery){

	$.net.config["post"]={
		'method':'POST',
		'async':true,
		'_reloadT':false,
		/*'listener':{
			'load':function(){
				//this.post();
			}
		},*/
		'thread':1
	}
	
	function ckString(obj){
		var str='';
		for(var c in obj){
			str+=obj[c];
		}
		return str;
	}

	var reqInfos=[];
	var ajax=$.net.ajax;
	$.net.post=(function(){
		return {
			'_init':function(_opt){
				$.extend($.net.config["post"],_opt);
				var cache=gw.cache[_opt._hostname];
				this.useInfos=cache.useInfos;
				this.chebox=_opt.chebox||false;
				console.log(this.useInfos);
				return this;
			},
			'plan':function(){	
				if(this.chebox==false){
					var temp=$('<div>'
						+'num:<input value="0" id="wgu_num" style="width:30px">'
						+'</div>').appendTo('#wgu_tool');
				}else{
					var temp=$('<div></div>').appendTo('#wgu_tool');
				}
				var me=this;
				$('<button>post</button>').appendTo(temp).bind('click',function (){
					me.post();
				});
			},
			'post':function (){										
				var me=this;
				if(this.chebox==false){
					document.getElementsByName('useInfo').forEach(function(v){
						if(v.checked){
							$(v).parent()[0].style.color='olivedrab';
							var _opt={'headers':{'wgu':ckString(me.useInfos[v.value].cookie)},'userInfo':me.useInfos[v.value]};
							$.extend(_opt,$.net.config["post"]);
							for(var i=0;i<$.net.config["post"].thread;i++){
								reqInfos.push(new ajax(_opt).post());
							}
						}
					})
				}else{
					for(var i in me.useInfos){
						var _opt={'headers':{'wgu':ckString(me.useInfos[i].cookie)},'userInfo':me.useInfos[i]};
						$.extend(_opt,$.net.config["post"]);
						for(var i=0;i<$.net.config["post"].thread;i++){
							reqInfos.push(new ajax(_opt).post());
						}
					}
				}
				return this;
			}
		}
	})();
	$.net.panel.panel['post']=1;
})(___jQuery,___jQuery);